package org.czx.datactruct.generic;

/**
 * @author czx
 * @date 2020/9/21 16:29
 */
public class MyClass {
    public static void main(String[] args) {
        Widget[] array = new Widget[10];
        array[0] = new Gadget();
        array[1] = new Widget();
        arrayMinimum(array);
    }


    public static <T extends Comparable<? super T>> T arrayMinimum(T[] anArray) {
        T minimum = anArray[0];
        for (T entry : anArray) {
            if (entry != null && entry.compareTo(minimum) < 0) {
                minimum = entry;
            }
        }
        return minimum;
    }
}
